/*
 * Copyright(c) 2021 Intel Corporation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @file ctx_json_utils.h
 *
 * Utility functions used by the driver to facilitate parsing cJSON structures,
 * as well as macro definitions for the Context JSON's fields.
 */

#ifndef __CTX_JSON_UTILS__
#define __CTX_JSON_UTILS__

#include <bf_types/bf_types.h>
#include <target_utils/cJSON.h>
#include <pipe_mgr/pipe_mgr_intf.h>

#define STAGE_TABLE_STR "stage_tables"
/*
 * Macro definitions for the Context JSON fields.
 */
#define CTX_JSON_COMPILER_VERSION "compiler_version"
#define CTX_JSON_MATCH_ATTRIBUTES_UNITS "units"
#define CTX_JSON_SCHEMA_VERSION "schema_version"
#define CTX_JSON_CHIP_TARGET "target"
#define STAGE_TABLE_STR "stage_tables"
#define CTX_JSON_MATCH_KEY_FIELDS_MATCH_TYPE_EXACT "exact"
#define CTX_JSON_COMPILER_VERSION "compiler_version"
#define CTX_JSON_MATCH_KEY_FIELDS_MATCH_TYPE_TERNARY "ternary"
#define CTX_JSON_MATCH_KEY_FIELDS_MATCH_TYPE_RANGE "range"
#define CTX_JSON_MATCH_KEY_FIELDS_MATCH_TYPE_RANGE "range"
#define CTX_JSON_TABLE_STAGE_TABLES STAGE_TABLE_STR
#define CTX_JSON_MATCH_KEY_FIELDS_MATCH_TYPE_LPM "lpm"
#define CTX_JSON_SCHEMA_VERSION "schema_version"
#define CTX_JSON_MATCH_KEY_FIELDS_IS_VALID "is_valid"
#define CTX_JSON_TABLE_TYPE_ACTION_DATA "action"
#define CTX_JSON_TABLE_TYPE_SELECTION "selection"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_TYPE "param_type"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_SHIFT "param_shift"
#define CTX_JSON_CHIP_TARGET "target"
#define CTX_JSON_TABLE_HOW_REFERENCED "how_referenced"
#define CTX_JSON_TABLE_TYPE_MATCH "match"
#define CTX_JSON_TABLE_HOW_REFERENCED "how_referenced"
#define CTX_JSON_MATCH_ATTRIBUTES_STAGE_TABLES STAGE_TABLE_STR
#define STAGE_TABLE_STR "stage_tables"
#define CTX_JSON_MATCH_TABLE_USES_RANGE "uses_range"
#define CTX_JSON_MATCH_TABLE_IS_RESOURCE_CONTROLLABLE \
  "is_resource_controllable"
#define CTX_JSON_TABLES_NODE "tables"
#define CTX_JSON_STAGE_TABLE_STAGE_TABLE_TYPE "stage_table_type"
#define CTX_JSON_TABLE_STATEFUL_TYPE "stateful_table_type"
#define CTX_JSON_TABLE_TABLE_TYPE "table_type"
#define CTX_JSON_STAGE_TABLE_TYPE_TERNARY_INDIRECTION "ternary_indirection"
#define CTX_JSON_TABLE_STATEFUL_DIRECTION "stateful_direction"
#define CTX_JSON_TABLE_DIRECTION "direction"
#define CTX_JSON_MATCH_TABLE_DEFAULT_ACTION_HANDLE "default_action_handle"
#define CTX_JSON_SELECTION_TABLE_BOUND_TO_STATEFUL_TABLE_HANDLE \
  "bound_to_stateful_table_handle"
#define CTX_JSON_SELECTION_TABLE_BOUND_TO_ACTION_DATA_TABLE_HANDLE \
  "bound_to_action_data_table_handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_DIRECT_RESOURCE_HANDLE "handle"
#define CTX_JSON_INDIRECT_RESOURCE_HANDLE "handle"
#define CTX_JSON_TABLE_STATEFUL_BOUND_TO_SELECTION_TABLE_HANDLE \
  "bound_to_selection_table_handle"
#define CTX_JSON_ACTION_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_HANDLE "param_handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_MATCH_ATTRIBUTES_SET_PARTITION_ACTION_HANDLE \
  "set_partition_action_handle"
#define CTX_JSON_MATCH_TABLE_REFERENCES_HANDLE "handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_PACK_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_HANDLE "handle"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_PARAM_HANDLE "param_handle"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_HANDLE "param_handle"
#define CTX_JSON_TABLE_HANDLE "handle"
#define CTX_JSON_STATIC_ENTRY_ACTION_HANDLE "action_handle"
#define CTX_JSON_METER_TABLE_PRE_COLOR_FIELD_NAME "pre_color_field_name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_DIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_PARAMETER_NAME "parameter_name"
#define CTX_JSON_TABLE_NAME "name"
#define CTX_JSON_ACTION_DATA_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_NAME "action_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_TABLE_NAME "table_name"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_NAME "param_name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_TABLES_NODE "tables"
#define CTX_JSON_STAGE_TABLE_STAGE_TABLE_TYPE "stage_table_type"
#define CTX_JSON_TABLE_STATEFUL_TYPE "stateful_table_type"
#define CTX_JSON_TABLE_TABLE_TYPE "table_type"
#define CTX_JSON_STAGE_TABLE_TYPE_TERNARY_INDIRECTION "ternary_indirection"
#define CTX_JSON_TABLE_STATEFUL_DIRECTION "stateful_direction"
#define CTX_JSON_TABLE_DIRECTION "direction"
#define CTX_JSON_MATCH_TABLE_DEFAULT_ACTION_HANDLE "default_action_handle"
#define CTX_JSON_SELECTION_TABLE_BOUND_TO_STATEFUL_TABLE_HANDLE \
  "bound_to_stateful_table_handle"
#define CTX_JSON_SELECTION_TABLE_BOUND_TO_ACTION_DATA_TABLE_HANDLE \
  "bound_to_action_data_table_handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_DIRECT_RESOURCE_HANDLE "handle"
#define CTX_JSON_INDIRECT_RESOURCE_HANDLE "handle"
#define CTX_JSON_TABLE_STATEFUL_BOUND_TO_SELECTION_TABLE_HANDLE \
  "bound_to_selection_table_handle"
#define CTX_JSON_ACTION_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_HANDLE "param_handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_MATCH_ATTRIBUTES_SET_PARTITION_ACTION_HANDLE \
  "set_partition_action_handle"
#define CTX_JSON_MATCH_TABLE_REFERENCES_HANDLE "handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_PACK_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_HANDLE "handle"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_PARAM_HANDLE "param_handle"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_HANDLE "param_handle"
#define CTX_JSON_TABLE_HANDLE "handle"
#define CTX_JSON_STATIC_ENTRY_ACTION_HANDLE "action_handle"
#define CTX_JSON_METER_TABLE_PRE_COLOR_FIELD_NAME "pre_color_field_name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_DIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_PARAMETER_NAME "parameter_name"
#define CTX_JSON_TABLE_NAME "name"
#define CTX_JSON_ACTION_DATA_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_NAME "action_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_TABLE_NAME "table_name"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_NAME "param_name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_IMMEDIATE_NAME "immediate_name"
#define CTX_JSON_MATCH_ATTRIBUTES_PARTITION_FIELD_NAME "partition_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_LPM_FIELD_NAME "lpm_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_EXCLUDED_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_INSTANCE_NAME "instance_name"
#define CTX_JSON_MATCH_KEY_FIELDS_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_NAME "name"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_NAME "param_name"
#define CTX_JSON_HARDWARE_BLOCK_NAME "name"
#define CTX_JSON_TERN_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_MATCH_KEY_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_ACTION_PARAMETER_NAME "parameter_name"
#define CTX_JSON_SELECTION_TABLE_MAX_PORT_POOL_SIZE "max_port_pool_size"
#define CTX_JSON_STAGE_TABLE_SIZE "size"
#define CTX_JSON_TABLE_SIZE "size"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_MOD_OBJ_SIZE "mod_obj_size"
#define CTX_JSON_MATCH_TABLE_STATEFUL_TABLE_REFS "stateful_table_refs"
#define CTX_JSON_MATCH_TABLE_STATISTICS_TABLE_REFS "statistics_table_refs"
#define CTX_JSON_MATCH_TABLE_METER_TABLE_REFS "meter_table_refs"
#define CTX_JSON_MATCH_TABLE_ACTION_DATA_TABLE_REFS "action_data_table_refs"
#define CTX_JSON_METER_TABLE_PRE_COLOR_FIELD_NAME "pre_color_field_name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_DIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_PARAMETER_NAME "parameter_name"
#define CTX_JSON_TABLE_NAME "name"
#define CTX_JSON_ACTION_DATA_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_NAME "action_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_TABLE_NAME "table_name"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_NAME "param_name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_IMMEDIATE_NAME "immediate_name"
#define CTX_JSON_MATCH_ATTRIBUTES_PARTITION_FIELD_NAME "partition_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_LPM_FIELD_NAME "lpm_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_EXCLUDED_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_INSTANCE_NAME "instance_name"
#define CTX_JSON_MATCH_KEY_FIELDS_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_NAME "name"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_NAME "param_name"
#define CTX_JSON_HARDWARE_BLOCK_NAME "name"
#define CTX_JSON_TERN_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_MATCH_KEY_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_ACTION_PARAMETER_NAME "parameter_name"
#define CTX_JSON_MATCH_TABLE_DEFAULT_ACTION_HANDLE "default_action_handle"
#define CTX_JSON_SELECTION_TABLE_BOUND_TO_STATEFUL_TABLE_HANDLE \
  "bound_to_stateful_table_handle"
#define CTX_JSON_SELECTION_TABLE_BOUND_TO_ACTION_DATA_TABLE_HANDLE \
  "bound_to_action_data_table_handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_DIRECT_RESOURCE_HANDLE "handle"
#define CTX_JSON_INDIRECT_RESOURCE_HANDLE "handle"
#define CTX_JSON_TABLE_STATEFUL_BOUND_TO_SELECTION_TABLE_HANDLE \
  "bound_to_selection_table_handle"
#define CTX_JSON_ACTION_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_HANDLE "param_handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_MATCH_TABLE_REFERENCES_HANDLE "handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_PACK_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_HANDLE "handle"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_PARAM_HANDLE "param_handle"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_HANDLE "param_handle"
#define CTX_JSON_TABLE_HANDLE "handle"
#define CTX_JSON_STATIC_ENTRY_ACTION_HANDLE "action_handle"
#define CTX_JSON_MATCH_TABLE_SELECTION_TABLE_REFS "selection_table_refs"
#define CTX_JSON_METER_TABLE_PRE_COLOR_FIELD_NAME "pre_color_field_name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_DIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_PARAMETER_NAME "parameter_name"
#define CTX_JSON_TABLE_NAME "name"
#define CTX_JSON_ACTION_DATA_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_NAME "action_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_TABLE_NAME "table_name"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_NAME "param_name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_IMMEDIATE_NAME "immediate_name"
#define CTX_JSON_MATCH_ATTRIBUTES_PARTITION_FIELD_NAME "partition_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_LPM_FIELD_NAME "lpm_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_EXCLUDED_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_INSTANCE_NAME "instance_name"
#define CTX_JSON_MATCH_KEY_FIELDS_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_NAME "name"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_NAME "param_name"
#define CTX_JSON_HARDWARE_BLOCK_NAME "name"
#define CTX_JSON_TERN_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_MATCH_KEY_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_ACTION_PARAMETER_NAME "parameter_name"
#define CTX_JSON_MATCH_TABLE_DEFAULT_ACTION_HANDLE "default_action_handle"
#define CTX_JSON_SELECTION_TABLE_BOUND_TO_STATEFUL_TABLE_HANDLE \
  "bound_to_stateful_table_handle"
#define CTX_JSON_SELECTION_TABLE_BOUND_TO_ACTION_DATA_TABLE_HANDLE \
  "bound_to_action_data_table_handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_DIRECT_RESOURCE_HANDLE "handle"
#define CTX_JSON_INDIRECT_RESOURCE_HANDLE "handle"
#define CTX_JSON_TABLE_STATEFUL_BOUND_TO_SELECTION_TABLE_HANDLE \
  "bound_to_selection_table_handle"
#define CTX_JSON_ACTION_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_HANDLE "param_handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_MATCH_TABLE_REFERENCES_HANDLE "handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_PACK_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_HANDLE "handle"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_PARAM_HANDLE "param_handle"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_HANDLE "param_handle"
#define CTX_JSON_TABLE_HANDLE "handle"
#define CTX_JSON_STATIC_ENTRY_ACTION_HANDLE "action_handle"
#define CTX_JSON_MATCH_TABLE_MATCH_KEY_FIELDS "match_key_fields"
#define CTX_JSON_STATIC_ENTRY_MATCH_KEY_FIELDS_VALUES "match_key_fields_values"
#define CTX_JSON_METER_TABLE_PRE_COLOR_FIELD_NAME "pre_color_field_name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_DIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_PARAMETER_NAME "parameter_name"
#define CTX_JSON_TABLE_NAME "name"
#define CTX_JSON_ACTION_DATA_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_NAME "action_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_TABLE_NAME "table_name"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_NAME "param_name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_IMMEDIATE_NAME "immediate_name"
#define CTX_JSON_MATCH_ATTRIBUTES_PARTITION_FIELD_NAME "partition_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_LPM_FIELD_NAME "lpm_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_EXCLUDED_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_INSTANCE_NAME "instance_name"
#define CTX_JSON_MATCH_KEY_FIELDS_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_NAME "name"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_NAME "param_name"
#define CTX_JSON_HARDWARE_BLOCK_NAME "name"
#define CTX_JSON_TERN_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_MATCH_KEY_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_ACTION_PARAMETER_NAME "parameter_name"
#define CTX_JSON_MATCH_KEY_FIELDS_INSTANCE_NAME "instance_name"
#define CTX_JSON_METER_TABLE_PRE_COLOR_FIELD_NAME "pre_color_field_name"
#define CTX_JSON_ACTION_DATA_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_PARTITION_FIELD_NAME "partition_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_LPM_FIELD_NAME "lpm_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_EXCLUDED_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_FIELD_NAME "field_name"
#define CTX_JSON_TERN_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_MATCH_KEY_FIELD_NAME "field_name"
#define CTX_JSON_HASH_BIT_MATCH_TYPE "match_type"
#define CTX_JSON_MATCH_ATTRIBUTES_MATCH_TYPE "match_type"
#define CTX_JSON_MATCH_KEY_FIELDS_MATCH_TYPE "match_type"
#define CTX_JSON_MATCH_TABLE_MATCH_ATTRIBUTES_MATCH_TYPE "match_type"
#define CTX_JSON_ACTION_DATA_ENTRY_FORMAT_START_BIT "start_bit"
#define CTX_JSON_EXACT_ENTRY_FORMAT_START_BIT "start_bit"
#define CTX_JSON_MATCH_KEY_FIELDS_START_BIT "start_bit"
#define CTX_JSON_ACTION_P4_PARAMETER_START_BIT "start_bit"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_START_BIT_OFFSET "start_bit_offset"
#define CTX_JSON_TERN_ENTRY_FORMAT_START_BIT "start_bit"
#define CTX_JSON_P4_PARAMETER_BIT_WIDTH "bit_width"
#define CTX_JSON_MATCH_KEY_FIELDS_BIT_WIDTH "bit_width"
#define CTX_JSON_MATCH_KEY_FIELDS_BIT_WIDTH_FULL "bit_width_full"
#define CTX_JSON_ACTION_P4_PARAMETER_BIT_WIDTH "bit_width"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_BIT_WIDTH "bit_width"
#define CTX_JSON_MATCH_KEY_FIELDS_BIT_WIDTH_FULL "bit_width_full"
#define CTX_JSON_METER_TABLE_ENABLE_PFE_BIT_POSITION "pfe_bit_position"
#define CTX_JSON_STATISTICS_TABLE_ENABLE_PFE_BIT_POSITION "pfe_bit_position"
#define CTX_JSON_MATCH_KEY_FIELDS_POSITION "position"
#define CTX_JSON_ACTION_P4_PARAMETER_POSITION "position"
#define CTX_JSON_MATCH_TABLE_ACTIONS "actions"
#define CTX_JSON_ACTION_FORMAT_HW_ACTIONS "hw_actions_list"
#define CTX_JSON_TABLE_ACTIONS "actions"
#define CTX_JSON_METER_TABLE_PRE_COLOR_FIELD_NAME "pre_color_field_name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_DIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_PARAMETER_NAME "parameter_name"
#define CTX_JSON_TABLE_NAME "name"
#define CTX_JSON_ACTION_DATA_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_NAME "action_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_TABLE_NAME "table_name"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_NAME "param_name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_IMMEDIATE_NAME "immediate_name"
#define CTX_JSON_MATCH_ATTRIBUTES_PARTITION_FIELD_NAME "partition_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_LPM_FIELD_NAME "lpm_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_EXCLUDED_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_INSTANCE_NAME "instance_name"
#define CTX_JSON_MATCH_KEY_FIELDS_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_NAME "name"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_NAME "param_name"
#define CTX_JSON_HARDWARE_BLOCK_NAME "name"
#define CTX_JSON_TERN_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_MATCH_KEY_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_ACTION_PARAMETER_NAME "parameter_name"
#define CTX_JSON_MATCH_TABLE_DEFAULT_ACTION_HANDLE "default_action_handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_DIRECT_RESOURCE_HANDLE "handle"
#define CTX_JSON_INDIRECT_RESOURCE_HANDLE "handle"
#define CTX_JSON_ACTION_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_HANDLE "param_handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_MATCH_TABLE_REFERENCES_HANDLE "handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_PACK_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_HANDLE "handle"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_PARAM_HANDLE "param_handle"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_HANDLE "param_handle"
#define CTX_JSON_TABLE_HANDLE "handle"
#define CTX_JSON_STATIC_ENTRY_ACTION_HANDLE "action_handle"
#define CTX_JSON_ACTION_IS_CONSTANT_ACTION "constant_default_action"
#define CTX_JSON_ACTION_IS_COMPILER_ADDED_ACTION "is_compiler_added_action"
#define CTX_JSON_ACTION_ALLOWED_AS_HIT_ACTION "allowed_as_hit_action"
#define CTX_JSON_ACTION_ALLOWED_AS_DEFAULT_ACTION "allowed_as_default_action"
#define CTX_JSON_ACTION_P4_PARAMETERS "p4_parameters"
#define CTX_JSON_ACTION_P4_PARAMETERS "p4_parameters"
#define CTX_JSON_METER_TABLE_PRE_COLOR_FIELD_NAME "pre_color_field_name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_DIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_PARAMETER_NAME "parameter_name"
#define CTX_JSON_TABLE_NAME "name"
#define CTX_JSON_ACTION_DATA_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_NAME "action_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_TABLE_NAME "table_name"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_NAME "param_name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_IMMEDIATE_NAME "immediate_name"
#define CTX_JSON_MATCH_ATTRIBUTES_PARTITION_FIELD_NAME "partition_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_LPM_FIELD_NAME "lpm_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_EXCLUDED_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_INSTANCE_NAME "instance_name"
#define CTX_JSON_MATCH_KEY_FIELDS_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_NAME "name"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_NAME "param_name"
#define CTX_JSON_HARDWARE_BLOCK_NAME "name"
#define CTX_JSON_TERN_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_MATCH_KEY_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_ACTION_PARAMETER_NAME "parameter_name"
#define CTX_JSON_ACTION_DATA_ENTRY_FORMAT_START_BIT "start_bit"
#define CTX_JSON_EXACT_ENTRY_FORMAT_START_BIT "start_bit"
#define CTX_JSON_MATCH_KEY_FIELDS_START_BIT "start_bit"
#define CTX_JSON_ACTION_P4_PARAMETER_START_BIT "start_bit"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_START_BIT_OFFSET "start_bit_offset"
#define CTX_JSON_TERN_ENTRY_FORMAT_START_BIT "start_bit"
#define CTX_JSON_P4_PARAMETER_BIT_WIDTH "bit_width"
#define CTX_JSON_MATCH_KEY_FIELDS_BIT_WIDTH "bit_width"
#define CTX_JSON_MATCH_KEY_FIELDS_BIT_WIDTH_FULL "bit_width_full"
#define CTX_JSON_ACTION_P4_PARAMETER_BIT_WIDTH "bit_width"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_BIT_WIDTH "bit_width"
#define CTX_JSON_METER_TABLE_ENABLE_PFE_BIT_POSITION "pfe_bit_position"
#define CTX_JSON_STATISTICS_TABLE_ENABLE_PFE_BIT_POSITION "pfe_bit_position"
#define CTX_JSON_MATCH_KEY_FIELDS_POSITION "position"
#define CTX_JSON_ACTION_P4_PARAMETER_POSITION "position"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_BYTE_ARRAY_INDEX "byte_array_index"
#define CTX_JSON_METER_TABLE_PRE_COLOR_FIELD_NAME "pre_color_field_name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_DIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_PARAMETER_NAME "parameter_name"
#define CTX_JSON_TABLE_NAME "name"
#define CTX_JSON_ACTION_DATA_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_NAME "action_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_TABLE_NAME "table_name"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_NAME "param_name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_IMMEDIATE_NAME "immediate_name"
#define CTX_JSON_MATCH_ATTRIBUTES_PARTITION_FIELD_NAME "partition_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_LPM_FIELD_NAME "lpm_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_EXCLUDED_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_INSTANCE_NAME "instance_name"
#define CTX_JSON_MATCH_KEY_FIELDS_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_NAME "name"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_NAME "param_name"
#define CTX_JSON_HARDWARE_BLOCK_NAME "name"
#define CTX_JSON_TERN_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_MATCH_KEY_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_ACTION_PARAMETER_NAME "parameter_name"
#define CTX_JSON_MATCH_TABLE_DEFAULT_ACTION_HANDLE "default_action_handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_DIRECT_RESOURCE_HANDLE "handle"
#define CTX_JSON_INDIRECT_RESOURCE_HANDLE "handle"
#define CTX_JSON_ACTION_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_HANDLE "param_handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_MATCH_TABLE_REFERENCES_HANDLE "handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_PACK_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_HANDLE "handle"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_PARAM_HANDLE "param_handle"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_HANDLE "param_handle"
#define CTX_JSON_TABLE_HANDLE "handle"
#define CTX_JSON_STATIC_ENTRY_ACTION_HANDLE "action_handle"
#define CTX_JSON_ACTION_IS_CONSTANT_ACTION "constant_default_action"
#define CTX_JSON_ACTION_IS_COMPILER_ADDED_ACTION "is_compiler_added_action"
#define CTX_JSON_ACTION_ALLOWED_AS_HIT_ACTION "allowed_as_hit_action"
#define CTX_JSON_ACTION_ALLOWED_AS_DEFAULT_ACTION "allowed_as_default_action"
#define CTX_JSON_ACTION_P4_PARAMETERS "p4_parameters"
#define CTX_JSON_ACTION_P4_PARAMETERS "p4_parameters"
#define CTX_JSON_METER_TABLE_PRE_COLOR_FIELD_NAME "pre_color_field_name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_DIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_PARAMETER_NAME "parameter_name"
#define CTX_JSON_TABLE_NAME "name"
#define CTX_JSON_ACTION_DATA_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_NAME "action_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_TABLE_NAME "table_name"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_NAME "param_name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_IMMEDIATE_NAME "immediate_name"
#define CTX_JSON_MATCH_ATTRIBUTES_PARTITION_FIELD_NAME "partition_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_LPM_FIELD_NAME "lpm_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_EXCLUDED_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_INSTANCE_NAME "instance_name"
#define CTX_JSON_MATCH_KEY_FIELDS_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_NAME "name"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_NAME "param_name"
#define CTX_JSON_HARDWARE_BLOCK_NAME "name"
#define CTX_JSON_TERN_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_MATCH_KEY_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_ACTION_PARAMETER_NAME "parameter_name"
#define CTX_JSON_MATCH_TABLE_DEFAULT_ACTION_HANDLE "default_action_handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_DIRECT_RESOURCE_HANDLE "handle"
#define CTX_JSON_INDIRECT_RESOURCE_HANDLE "handle"
#define CTX_JSON_ACTION_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_HANDLE "param_handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_MATCH_TABLE_REFERENCES_HANDLE "handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_PACK_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_HANDLE "handle"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_PARAM_HANDLE "param_handle"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_HANDLE "param_handle"
#define CTX_JSON_TABLE_HANDLE "handle"
#define CTX_JSON_STATIC_ENTRY_ACTION_HANDLE "action_handle"
#define CTX_JSON_ACTION_IS_CONSTANT_ACTION "constant_default_action"
#define CTX_JSON_ACTION_IS_COMPILER_ADDED_ACTION "is_compiler_added_action"
#define CTX_JSON_ACTION_ALLOWED_AS_HIT_ACTION "allowed_as_hit_action"
#define CTX_JSON_ACTION_ALLOWED_AS_DEFAULT_ACTION "allowed_as_default_action"
#define CTX_JSON_ACTION_P4_PARAMETERS "p4_parameters"
#define CTX_JSON_ACTION_P4_PARAMETERS "p4_parameters"
#define CTX_JSON_MATCH_TABLE_MATCH_ATTRIBUTES "match_attributes"
#define STAGE_TABLE_STR "stage_tables"
#define CTX_JSON_STAGE_TABLE_ACTION_FORMAT "action_format"
#define CTX_JSON_HARDWARE_BLOCK_ACTION_FORMAT "action_format"
#define CTX_JSON_ACTION_FORMAT_ACTION_NAME "action_name"
#define CTX_JSON_MATCH_TABLE_DEFAULT_ACTION_HANDLE "default_action_handle"
#define CTX_JSON_ACTION_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_PACK_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_STATIC_ENTRY_ACTION_HANDLE "action_handle"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS "immediate_fields"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_NAME "param_name"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_NAME "param_name"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_DEST_START "dest_start"
#define CTX_JSON_CONST_TUPLE_DEST_START "dest_start"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_DEST_WIDTH "dest_width"
#define CTX_JSON_CONST_TUPLE_DEST_WIDTH "dest_width"
#define CTX_JSON_ACTION_FORMAT_ACTION_NAME "action_name"
#define CTX_JSON_MATCH_TABLE_DEFAULT_ACTION_HANDLE "default_action_handle"
#define CTX_JSON_ACTION_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_PACK_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_STATIC_ENTRY_ACTION_HANDLE "action_handle"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS "immediate_fields"
#define CTX_JSON_ACTION_FORMAT_ACTION_NAME "action_name"
#define CTX_JSON_MATCH_TABLE_DEFAULT_ACTION_HANDLE "default_action_handle"
#define CTX_JSON_ACTION_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_PACK_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_STATIC_ENTRY_ACTION_HANDLE "action_handle"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS "immediate_fields"
#define CTX_JSON_MATCH_TABLE_DEFAULT_ACTION_HANDLE "default_action_handle"
#define CTX_JSON_STAGE_TABLE_STAGE_TABLE_TYPE "stage_table_type"
#define CTX_JSON_TABLE_STATEFUL_TYPE "stateful_table_type"
#define CTX_JSON_TABLE_TABLE_TYPE "table_type"
#define CTX_JSON_STAGE_TABLE_TYPE_TERNARY_INDIRECTION "ternary_indirection"
#define CTX_JSON_TABLE_STATEFUL_DIRECTION "stateful_direction"
#define CTX_JSON_TABLE_DIRECTION "direction"
#define CTX_JSON_MATCH_TABLE_DEFAULT_ACTION_HANDLE "default_action_handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_DIRECT_RESOURCE_HANDLE "handle"
#define CTX_JSON_INDIRECT_RESOURCE_HANDLE "handle"
#define CTX_JSON_ACTION_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_HANDLE "param_handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_MATCH_TABLE_REFERENCES_HANDLE "handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_PACK_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_HANDLE "handle"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_PARAM_HANDLE "param_handle"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_HANDLE "param_handle"
#define CTX_JSON_TABLE_HANDLE "handle"
#define CTX_JSON_STATIC_ENTRY_ACTION_HANDLE "action_handle"
#define CTX_JSON_METER_TABLE_PRE_COLOR_FIELD_NAME "pre_color_field_name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_DIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_PARAMETER_NAME "parameter_name"
#define CTX_JSON_TABLE_NAME "name"
#define CTX_JSON_ACTION_FORMAT_ACTION_NAME "action_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_TABLE_NAME "table_name"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_NAME "param_name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_IMMEDIATE_NAME "immediate_name"
#define CTX_JSON_MATCH_ATTRIBUTES_PARTITION_FIELD_NAME "partition_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_LPM_FIELD_NAME "lpm_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_EXCLUDED_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_INSTANCE_NAME "instance_name"
#define CTX_JSON_MATCH_KEY_FIELDS_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_NAME "name"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_NAME "param_name"
#define CTX_JSON_HARDWARE_BLOCK_NAME "name"
#define CTX_JSON_TERN_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_MATCH_KEY_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_ACTION_PARAMETER_NAME "parameter_name"
#define CTX_JSON_SELECTION_TABLE_MAX_PORT_POOL_SIZE "max_port_pool_size"
#define CTX_JSON_STAGE_TABLE_SIZE "size"
#define CTX_JSON_TABLE_SIZE "size"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_MOD_OBJ_SIZE "mod_obj_size"
#define CTX_JSON_STAGE_TABLE_STAGE_TABLE_TYPE "stage_table_type"
#define CTX_JSON_TABLE_STATEFUL_TYPE "stateful_table_type"
#define CTX_JSON_TABLE_TABLE_TYPE "table_type"
#define CTX_JSON_STAGE_TABLE_TYPE_TERNARY_INDIRECTION "ternary_indirection"
#define CTX_JSON_TABLE_STATEFUL_DIRECTION "stateful_direction"
#define CTX_JSON_TABLE_DIRECTION "direction"
#define CTX_JSON_MATCH_TABLE_DEFAULT_ACTION_HANDLE "default_action_handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_DIRECT_RESOURCE_HANDLE "handle"
#define CTX_JSON_INDIRECT_RESOURCE_HANDLE "handle"
#define CTX_JSON_ACTION_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_HANDLE "param_handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_MATCH_TABLE_REFERENCES_HANDLE "handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_PACK_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_HANDLE "handle"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_PARAM_HANDLE "param_handle"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_HANDLE "param_handle"
#define CTX_JSON_TABLE_HANDLE "handle"
#define CTX_JSON_STATIC_ENTRY_ACTION_HANDLE "action_handle"
#define CTX_JSON_METER_TABLE_PRE_COLOR_FIELD_NAME "pre_color_field_name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_DIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_PARAMETER_NAME "parameter_name"
#define CTX_JSON_TABLE_NAME "name"
#define CTX_JSON_ACTION_DATA_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_NAME "action_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_TABLE_NAME "table_name"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_NAME "param_name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_IMMEDIATE_NAME "immediate_name"
#define CTX_JSON_MATCH_ATTRIBUTES_PARTITION_FIELD_NAME "partition_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_LPM_FIELD_NAME "lpm_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_EXCLUDED_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_INSTANCE_NAME "instance_name"
#define CTX_JSON_MATCH_KEY_FIELDS_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_NAME "name"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_NAME "param_name"
#define CTX_JSON_HARDWARE_BLOCK_NAME "name"
#define CTX_JSON_TERN_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_MATCH_KEY_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_ACTION_PARAMETER_NAME "parameter_name"
#define CTX_JSON_SELECTION_TABLE_MAX_PORT_POOL_SIZE "max_port_pool_size"
#define CTX_JSON_STAGE_TABLE_SIZE "size"
#define CTX_JSON_TABLE_SIZE "size"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_MOD_OBJ_SIZE "mod_obj_size"
#define CTX_JSON_MATCH_TABLE_ACTIONS "actions"
#define CTX_JSON_ACTION_FORMAT_HW_ACTIONS "hw_actions_list"
#define CTX_JSON_TABLE_ACTIONS "actions"
#define CTX_JSON_METER_TABLE_PRE_COLOR_FIELD_NAME "pre_color_field_name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_DIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_PARAMETER_NAME "parameter_name"
#define CTX_JSON_TABLE_NAME "name"
#define CTX_JSON_ACTION_DATA_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_NAME "action_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_TABLE_NAME "table_name"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_NAME "param_name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_IMMEDIATE_NAME "immediate_name"
#define CTX_JSON_MATCH_ATTRIBUTES_PARTITION_FIELD_NAME "partition_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_LPM_FIELD_NAME "lpm_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_EXCLUDED_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_INSTANCE_NAME "instance_name"
#define CTX_JSON_MATCH_KEY_FIELDS_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_NAME "name"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_NAME "param_name"
#define CTX_JSON_HARDWARE_BLOCK_NAME "name"
#define CTX_JSON_TERN_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_MATCH_KEY_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_ACTION_PARAMETER_NAME "parameter_name"
#define CTX_JSON_MATCH_TABLE_DEFAULT_ACTION_HANDLE "default_action_handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_DIRECT_RESOURCE_HANDLE "handle"
#define CTX_JSON_INDIRECT_RESOURCE_HANDLE "handle"
#define CTX_JSON_ACTION_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_HANDLE "param_handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_MATCH_TABLE_REFERENCES_HANDLE "handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_PACK_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_HANDLE "handle"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_PARAM_HANDLE "param_handle"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_HANDLE "param_handle"
#define CTX_JSON_TABLE_HANDLE "handle"
#define CTX_JSON_STATIC_ENTRY_ACTION_HANDLE "action_handle"
#define CTX_JSON_ACTION_P4_PARAMETERS "p4_parameters"
#define CTX_JSON_ACTION_P4_PARAMETERS "p4_parameters"
#define CTX_JSON_METER_TABLE_PRE_COLOR_FIELD_NAME "pre_color_field_name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_DIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_PARAMETER_NAME "parameter_name"
#define CTX_JSON_TABLE_NAME "name"
#define CTX_JSON_ACTION_DATA_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_NAME "action_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_TABLE_NAME "table_name"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_NAME "param_name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_IMMEDIATE_NAME "immediate_name"
#define CTX_JSON_MATCH_ATTRIBUTES_PARTITION_FIELD_NAME "partition_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_LPM_FIELD_NAME "lpm_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_EXCLUDED_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_INSTANCE_NAME "instance_name"
#define CTX_JSON_MATCH_KEY_FIELDS_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_NAME "name"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_NAME "param_name"
#define CTX_JSON_HARDWARE_BLOCK_NAME "name"
#define CTX_JSON_TERN_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_MATCH_KEY_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_ACTION_PARAMETER_NAME "parameter_name"
#define CTX_JSON_ACTION_DATA_ENTRY_FORMAT_START_BIT "start_bit"
#define CTX_JSON_EXACT_ENTRY_FORMAT_START_BIT "start_bit"
#define CTX_JSON_MATCH_KEY_FIELDS_START_BIT "start_bit"
#define CTX_JSON_ACTION_P4_PARAMETER_START_BIT "start_bit"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_START_BIT_OFFSET "start_bit_offset"
#define CTX_JSON_TERN_ENTRY_FORMAT_START_BIT "start_bit"
#define CTX_JSON_P4_PARAMETER_BIT_WIDTH "bit_width"
#define CTX_JSON_MATCH_KEY_FIELDS_BIT_WIDTH "bit_width"
#define CTX_JSON_MATCH_KEY_FIELDS_BIT_WIDTH_FULL "bit_width_full"
#define CTX_JSON_ACTION_P4_PARAMETER_BIT_WIDTH "bit_width"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_BIT_WIDTH "bit_width"
#define CTX_JSON_METER_TABLE_ENABLE_PFE_BIT_POSITION "pfe_bit_position"
#define CTX_JSON_STATISTICS_TABLE_ENABLE_PFE_BIT_POSITION "pfe_bit_position"
#define CTX_JSON_MATCH_KEY_FIELDS_POSITION "position"
#define CTX_JSON_ACTION_P4_PARAMETER_POSITION "position"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_BYTE_ARRAY_INDEX "byte_array_index"
#define CTX_JSON_METER_TABLE_PRE_COLOR_FIELD_NAME "pre_color_field_name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_DIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_PARAMETER_NAME "parameter_name"
#define CTX_JSON_TABLE_NAME "name"
#define CTX_JSON_ACTION_DATA_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_NAME "action_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_TABLE_NAME "table_name"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_NAME "param_name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_IMMEDIATE_NAME "immediate_name"
#define CTX_JSON_MATCH_ATTRIBUTES_PARTITION_FIELD_NAME "partition_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_LPM_FIELD_NAME "lpm_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_EXCLUDED_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_INSTANCE_NAME "instance_name"
#define CTX_JSON_MATCH_KEY_FIELDS_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_NAME "name"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_NAME "param_name"
#define CTX_JSON_HARDWARE_BLOCK_NAME "name"
#define CTX_JSON_TERN_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_MATCH_KEY_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_ACTION_PARAMETER_NAME "parameter_name"
#define CTX_JSON_MATCH_TABLE_DEFAULT_ACTION_HANDLE "default_action_handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_DIRECT_RESOURCE_HANDLE "handle"
#define CTX_JSON_INDIRECT_RESOURCE_HANDLE "handle"
#define CTX_JSON_ACTION_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_HANDLE "param_handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_MATCH_TABLE_REFERENCES_HANDLE "handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_PACK_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_HANDLE "handle"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_PARAM_HANDLE "param_handle"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_HANDLE "param_handle"
#define CTX_JSON_TABLE_HANDLE "handle"
#define CTX_JSON_STATIC_ENTRY_ACTION_HANDLE "action_handle"
#define CTX_JSON_ACTION_P4_PARAMETERS "p4_parameters"
#define CTX_JSON_ACTION_P4_PARAMETERS "p4_parameters"
#define CTX_JSON_METER_TABLE_PRE_COLOR_FIELD_NAME "pre_color_field_name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_DIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_RESOURCE_NAME "resource_name"
#define CTX_JSON_INDIRECT_RESOURCE_PARAMETER_NAME "parameter_name"
#define CTX_JSON_TABLE_NAME "name"
#define CTX_JSON_ACTION_DATA_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_NAME "action_name"
#define CTX_JSON_ACTION_FORMAT_ACTION_TABLE_NAME "table_name"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_NAME "param_name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_EXACT_ENTRY_FORMAT_IMMEDIATE_NAME "immediate_name"
#define CTX_JSON_MATCH_ATTRIBUTES_PARTITION_FIELD_NAME "partition_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_LPM_FIELD_NAME "lpm_field_name"
#define CTX_JSON_MATCH_ATTRIBUTES_EXCLUDED_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_INSTANCE_NAME "instance_name"
#define CTX_JSON_MATCH_KEY_FIELDS_FIELD_NAME "field_name"
#define CTX_JSON_MATCH_KEY_FIELDS_NAME "name"
#define CTX_JSON_ACTION_NAME "name"
#define CTX_JSON_P4_PARAMETER_NAME "name"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_NAME "name"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_NAME "param_name"
#define CTX_JSON_HARDWARE_BLOCK_NAME "name"
#define CTX_JSON_TERN_ENTRY_FORMAT_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_MATCH_KEY_FIELD_NAME "field_name"
#define CTX_JSON_STATIC_ENTRY_ACTION_PARAMETER_NAME "parameter_name"
#define CTX_JSON_MATCH_TABLE_DEFAULT_ACTION_HANDLE "default_action_handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_DIRECT_RESOURCE_HANDLE "handle"
#define CTX_JSON_INDIRECT_RESOURCE_HANDLE "handle"
#define CTX_JSON_ACTION_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_ACTION_FORMAT_IMMEDIATE_FIELDS_PARAM_HANDLE "param_handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_MATCH_TABLE_REFERENCES_HANDLE "handle"
#define CTX_JSON_ACTION_HANDLE "handle"
#define CTX_JSON_PACK_FORMAT_ACTION_HANDLE "action_handle"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_HANDLE "handle"
#define CTX_JSON_HW_ACTIONS_MOD_FIELDS_PARAM_HANDLE "param_handle"
#define CTX_JSON_ACTION_FORMAT_HW_ACTION_PARAM_HANDLE "param_handle"
#define CTX_JSON_TABLE_HANDLE "handle"
#define CTX_JSON_STATIC_ENTRY_ACTION_HANDLE "action_handle"
#define CTX_JSON_ACTION_P4_PARAMETERS "p4_parameters"
#define CTX_JSON_ACTION_P4_PARAMETERS "p4_parameters"
#define CTX_JSON_MATCH_TABLE_DEFAULT_ACTION_HANDLE "default_action_handle"
/*
 * Macro definition that allows iterating over a cJSON array.
 */
#define CTX_JSON_FOR_EACH(it, parent) \
  for ((it) = (parent)->child; (it) != NULL; (it) = (it)->next)

#define GETARRITEM(arr, i) (cJSON_GetArrayItem((arr), i))
#define GETARRSZ(arr) (cJSON_GetArraySize((arr)))

typedef enum {
  CTX_JSON_MATCH_TYPE_VALID,
  CTX_JSON_MATCH_TYPE_EXACT,
  CTX_JSON_MATCH_TYPE_LPM,
  CTX_JSON_MATCH_TYPE_TERNARY,
  CTX_JSON_MATCH_TYPE_RANGE,
  CTX_JSON_MATCH_TYPE_INVALID
} ctx_json_match_type;

int bf_cjson_get_string(cJSON *cjson, char *property, char **ret);
int bf_cjson_get_string_dup(cJSON *cjson, char *property, char **ret);
int bf_cjson_try_get_string(cJSON *cjson, char *property, char **ret);
int bf_cjson_try_get_string_dup(cJSON *cjson, char *property, char **ret);
int bf_cjson_get_hex(cJSON *cjson, char *property, uint8_t *ret, uint8_t len);
int bf_cjson_try_get_hex(cJSON *cjson,
                         char *property,
                         uint8_t *ret,
                         uint8_t len);
int bf_cjson_has_hex(cJSON *cjson, char *property);
int bf_cjson_get_int(cJSON *cjson, char *property, int *ret);
int bf_cjson_try_get_int(cJSON *cjson, char *property, int *ret);
bool bf_cjson_has_int(cJSON *cjson, const char *property);
int bf_cjson_get_double(cJSON *cjson, char *property, double *ret);
int bf_cjson_try_get_double(cJSON *cjson, char *property, double *ret);
int bf_cjson_get_bool(cJSON *cjson, char *property, bool *ret);
int bf_cjson_try_get_bool(cJSON *cjson, char *property, bool *ret);
int bf_cjson_get_first(cJSON *cjson, cJSON **ret);
int bf_cjson_try_get_first(cJSON *cjson, cJSON **ret);
int bf_cjson_get_object(cJSON *cjson, char *property, cJSON **ret);
int bf_cjson_try_get_object(cJSON *cjson, char *property, cJSON **ret);
int bf_cjson_get_array_item(cJSON *cjson, int i, cJSON **ret);
int bf_cjson_get_handle(bf_dev_id_t devid,
                        profile_id_t prof_id,
                        cJSON *cjson,
                        char *property,
                        int *ret);
int bf_cjson_try_get_handle(bf_dev_id_t devid,
                            profile_id_t prof_id,
                            cJSON *cjson,
                            char *property,
                            int *ret);
int ctx_json_parse_action_spec_details_for_field(cJSON *action_cjson,
                                                 char *field_to_find,
                                                 int *spec_length_ret,
                                                 int *spec_offset_ret);

int ctx_json_parse_spec_details_for_key_length(cJSON *match_key_fields_cjson,
                                               int *key_length);

int ctx_json_parse_spec_details_for_field(cJSON *match_key_fields_cjson,
                                          char *field_to_find,
                                          int *spec_length_ret,
                                          int *spec_offset_ret,
                                          int *match_type_ret);
int ctx_json_parse_all_match_stage_tables(cJSON *tables_cjson,
                                          int max_number_stage_tables,
                                          cJSON **all_stage_tables_cjson,
                                          int *number_stage_tables);
int ctx_json_parse_all_match_stage_tables_for_table(
    cJSON *table_cjson,
    int max_number_stage_tables,
    cJSON **all_stage_tables_cjson,
    int *number_stage_tables);
int ctx_json_parse_action_for_action_handle(bf_dev_id_t devid,
                                            profile_id_t prof_id,
                                            cJSON *actions_cjson,
                                            int action_handle,
                                            cJSON **ret);
int ctx_json_parse_action_parameter_for_parameter(cJSON *action_cjson,
                                                  char *parameter_to_find,
                                                  int *bit_width_ret);
int ctx_json_parse_match_key_field(cJSON *match_key_field,
                                   int *bit_width_full,
                                   int *match_type,
                                   int *start_bit,
                                   int *bit_width,
                                   int *position,
                                   char **name);
void ctx_json_hex_to_stream(char *hex, uint8_t *ret, uint8_t len);

#endif  // __CTX_JSON_UTILS__
